package org.istt.domain;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * FileStatus entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="TBL_FILE_STATUS"
    ,schema="dbo"
    ,catalog="onegate"
)

public class FileStatus extends BaseObject<Long> implements java.io.Serializable {


    // Fields    

     /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long id;
    private String status;
    //private Set<WorkflowProcess> workflowProcesses = new HashSet<WorkflowProcess>(0); 
    private Set<File> files = new HashSet<File>(0); 

    // Constructors

    /** default constructor */
    public FileStatus() {
    }

    // Property accessors
    @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="ID", unique=true, nullable=false)

    public Long getId() {
        return this.id;
    }


	public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="STATUS", length=50)

    public String getStatus() {
        return this.status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
	/**
	 * @return the workflowProcesses
	 */
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="fileStatus")
	public Set<File> getFiles() {
		return files;
	}

	public void setFiles(Set<File> files) {
		this.files = files;
	}

	@Override
	public int hashCode() {
		int result;
		result = status.hashCode();
		result = 29 * result;
		return result;
	}

	@Override
	public String toString() {
		return new StringBuilder("id = ").append(id).append(", status = ").append(status).toString();
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (!(o instanceof FileStatus)) return false;

		final FileStatus fs = (FileStatus) o;


        if (!getStatus().equals(fs.getStatus())) return false;

		return true;
	}
}